<template>
    <el-menu
      default-active="2"
      class="el-menu-vertical-demo"
      @select="turnToPage($event)"
    >
    <el-menu-item index="/home">home</el-menu-item>
      <el-sub-menu index="/">
        <template #title>
          <span>目录一</span>
        </template>
        <el-menu-item index="/vue_task">Vue 学习任务</el-menu-item>
      </el-sub-menu>
    </el-menu>
  </template>
  
  <script lang="ts" setup>
  import { ref } from 'vue'
  import {
    Document,
    Menu as IconMenu,
    Location,
    Setting,
  } from '@element-plus/icons-vue'
import router from '@/router';
  
  function turnToPage(path){
    if(path !== '/'){
      router.push(path)
    }

  }
  </script>
  
  <style>
  .el-menu-vertical-demo:not(.el-menu--collapse) {
    width: 200px;
    min-height: 400px;
  }
  </style>